#include <cstdio>
#include <string>
#include <iostream>
#include <map>

using namespace std;

const int maxn = 60;
const int maxm = 200;

struct node{
    int ch[maxn];
    int nxt;
    bool kind;
};

struct High{
    int num[100];
    int len;
    High operator +( const High &b ){
        High tmp;
        memset( tmp.num, 0, sizeof( tmp.num ) );
        int l=0;
        if ( len>b.len )
            l=len;
        else
            l=b.len;
        int j=0;
        for ( int i=1; i<=l; i++ ){
            int t = num[i]+b.num[i]+j;
            tmp.num[i] = t%10;
            j = t/10;
        }
        if ( j>0 ){
            l++; tmp.num[l] = 1;
        }
        tmp.len=l;
        return tmp;
    }
    void out(){
        for ( int i=len; i>0; i-- )
            printf("%d", num[i]);
        printf("\n");
    }
};

int n, m, p;
map< char, int > wh;
node tree[maxm];
int fa1[maxm], fa2[maxm];
string s;
int tot;
int h, t;
int q[maxm];
High f[maxm][maxn];
High ans;

void insert( int t, int l ){
    if ( l==s.size() ){
        tree[t].kind = true;
        return;
    }
    int tmp = wh[s[l]];
    if ( tree[t].ch[tmp]==-1 )
        tree[t].ch[tmp] = tot++;
    insert( tree[t].ch[tmp], l+1 );
}

void clear(){
    for ( int i=0; i<maxm; i++ ){
        for ( int j=0; j<maxn; j++ )
            tree[i].ch[j]=-1;
        tree[i].nxt=-1;
        tree[i].kind=false;
    }
}

void count_nxt(){
    tree[0].nxt=-1;
    h=0; t=0;
    for ( int i=0; i<n; i++ )
        if ( tree[0].ch[i]!=-1 ){
            int tt = tree[0].ch[i];
            tree[tt].nxt = 0;
            t++; q[t] = tt;
        }
    while ( h<t ){
        h++;
        for ( int i=0; i<n; i++ )
            if ( tree[q[h]].ch[i]!=-1 ){
                int tt = tree[q[h]].ch[i];
                int tmp = tree[q[h]].nxt;
                while ( tmp!=-1 && tree[tmp].ch[i]==-1 ) tmp = tree[tmp].nxt;
                if ( tmp!=-1 )
                    tree[tt].nxt = tree[tmp].ch[i];
                else
                    tree[tt].nxt = 0;
                t++; q[t] = tt;
            }
    }
}

void count_ch(){
    h=0; t=1; q[1]=0;
    while ( h<t ){
        h++;
        int tmp = tree[q[h]].nxt;
        if ( tmp!=-1 )
            tree[q[h]].kind = tree[q[h]].kind | tree[tmp].kind;
        for ( int i=0; i<n; i++ )
            if (tree[q[h]].ch[i]==-1){
                int tmp = tree[q[h]].nxt;
                if ( tmp==-1 )
                    tree[q[h]].ch[i]=0;
                else
                    tree[q[h]].ch[i]=tree[tmp].ch[i];
            } else {
                t++; q[t] = tree[q[h]].ch[i];
            }
    }
}

void clearf(){
    for ( int i=0; i<maxm; i++ )
        for ( int j=0; j<maxn; j++ ){
            f[i][j].len=0;
        }
}

void dp(){
    clearf();
    f[0][0].len=1; f[0][0].num[1]=1;
    for ( int i=0; i<m; i++ )
        for ( int j=0; j<tot; j++ )
            if ( f[j][i].len!=0 ){
               // printf("%d %d\n", j, i);
                for ( int k=0; k<n; k++ ){
                    int tt = tree[j].ch[k];
                    if ( ! tree[tt].kind ){
                        f[tt][i+1]=f[tt][i+1]+f[j][i];
                        //printf("%d\n", f[tt][i+1].len);
                    }
                }
            }
/*    h=0; t=1; q1[1]=0; q2[1]=0;
    while ( h<t ){
        h++;
        int t1 = q1[h], t2 = q2[h];
        if ( t2==m ) continue;
        for ( int i=0; i<n; i++ ){
            int tt = tree[t1].ch[i];
            if ( ! tree[tt].kind ){
                if ( f[tt][t2+1]==0 ){
                    t++; q1[t]=tt; q2[t]=t2+1;
                }
                f[tt][t2+1]+=f[t1][t2];
            }
        }
    }*/
}

int main(){
    scanf("%d %d %d\n", &n, &m, &p);
    clear();
    tot=1;
    getline( cin, s );
    for ( int i=0; i<n; i++ )
        wh[s[i]]=i;
    for ( int i=0; i<p; i++ ){
        getline( cin, s );
        insert(0, 0);
    }
    count_nxt();
    count_ch();
   /* for ( int i=0; i<tot; i++ ){
        printf("Node %d:\n", i);
        printf("Child:\n");
        for ( int j=0; j<n; j++ )
            printf("%d\n", tree[i].ch[j]);
        printf("%d\n", tree[i].nxt);
        cout<<tree[i].kind<<endl;
    }*/
    dp();
    ans.len=1; ans.num[1]=0;
    for ( int i=0; i<tot; i++ )
        if ( f[i][m].len!=0 )
            ans=ans+f[i][m];
    ans.out();
}
